import vuels from 'vue-ls';
import ElementUI from 'element-ui';
import ItsStorage from 'its-storage';
import Contextmenu from 'vue-contextmenujs';
import FormFrame from '@/components/formFrame';
import tinyEditor from '@/components/tinyEditor';
import BlockTable from '@/components/blockTable';
import CommonFrame from '@/components/commonFrame';
import swSimpleUploader from '@/components/swSimpleUploader';

ElementUI.Dialog.props.closeOnClickModal.default = false;
ElementUI.Message.defaultOptions = {
	duration: 100 // 消息持续时间，默认3000毫秒
};

export default {
	install(Vue) {
		//加载ElementUI
		Vue.use(ElementUI);

		//全局注册表单组件
		Vue.use(FormFrame);

		//全局注册TinyEditor组件
		Vue.use(tinyEditor);

		//全局注册块表格组件
		Vue.use(BlockTable);

		//全局注册列表组件
		Vue.use(CommonFrame);

		//加载右键组件
		Vue.use(Contextmenu);

		//分片上传
		Vue.use(swSimpleUploader);

		//本地存储开始
		Vue.prototype.$local = ItsStorage.create({ storage: 'local', namespace: 'sw_' });

		//会话存储
		Vue.prototype.$session = ItsStorage.create({ storage: 'session', namespace: 'sw_' });

		//内存存储
		Vue.use(vuels, { storage: 'memory', name: 'memory', namespace: 'sw_' });

	}
}